package com.cjl.host.controller.v1;

import com.cjl.common.dtos.PageDto;
import com.cjl.common.dtos.ResponseResult;
import com.cjl.food.dtos.FoodDto;
import com.cjl.host.service.HostService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * @author cjl
 * @version v1.0
 * @description TODO
 * @createTime 2023/2/15 12:03
 */
@Api(value = "HostController",description = "店家信息")
@RestController
@RequestMapping("/api/host")
public class HostController {

    @Autowired
    HostService hostService;

    @ApiOperation("修改店名")
    @GetMapping("modifyHostName")
    public ResponseResult modifyHostName(@RequestParam("hostName") String hostName){
        return hostService.modifyHostName(hostName);
    }

    @ApiOperation("添加菜品")
    @PostMapping("/addFood")
    public ResponseResult addFood(@RequestBody FoodDto foodDto){
        return hostService.addFood(foodDto);
    }

    @ApiOperation("根据菜名删除菜品")
    @GetMapping("/deleteFood")
    public ResponseResult deleteFood(@RequestParam("foodName") String foodName){
        return hostService.deleteFood(foodName);
    }


    @ApiOperation("修改菜品")
    @PostMapping("/modifyFood")
    public ResponseResult modifyFood(@RequestBody FoodDto foodDto){
        return hostService.modifyFood(foodDto);
    }

    @ApiOperation("根据菜名查询菜品")
    @GetMapping("/searchFood")
    public ResponseResult searchFood(@RequestParam("foodName") String foodName){
        return hostService.searchFood(foodName);
    }
    @ApiOperation("菜品列表")
    @PostMapping("/foodList")
    public ResponseResult foodList(@RequestBody PageDto pageDto){
        return hostService.foodList(pageDto);
    }



}
